import request from '@/utils/request.js'

// 获取新闻详情
// path: /v1_0/articles/:article_id
export const getArticleResult = articleId => {
  return request({
    method: 'GET',
    url: `/v1_0/articles/${articleId}`
  })
}

// 收藏文章
// path: /v1_0/article/collections
export const collectionsArticle = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target
    }
  })
}

// 取消收藏文章
// path: /v1_0/article/collections/:target
export const deleteCollectionsArticle = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/collections/${target}`
  })
}

// 对文章点赞
// path: /v1_0/article/likings
export const likeingArticle = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target
    }
  })
}

// 取消对文章点赞
// path: /v1_0/article/likings/:target
export const deleteLikeingArticle = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/likings/${target}`
  })
}
